package com.example.suspensionbardemo.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

/**
 * @author ypk
 * 创建日期：2022/1/14  8:54
 * 描述：
 */
public class ViewPagerAdapter extends FragmentPagerAdapter {


    private List<Fragment> data;

    public ViewPagerAdapter(@NonNull FragmentManager fm, List<Fragment> data) {
        super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
        this.data = data;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return data.get(position);
    }

    @Override
    public int getCount() {
        return data.size();
    }
}
